package com.example.service;

import com.example.dao.FileInfoDao;
import com.example.model.FileInfo;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class FileInfoServiceImpl implements FileInfoService {
    private FileInfoDao fileInfoDao;

    public FileInfoServiceImpl(FileInfoDao fileInfoDao) {
        this.fileInfoDao = fileInfoDao;
    }

    @Override
    public int insertFileInfo(FileInfo fileInfo) {
        if (fileInfo != null) {
            return fileInfoDao.insertFileInfo(fileInfo);
        }
        return 0;
    }

    @Override
    public List<FileInfo> listFileInfos() {
        return fileInfoDao.listFileInfos();
    }

    @Override
    public FileInfo findByUUid(String UUid) {
        if (UUid != null) {
            return fileInfoDao.findByUUid(UUid);
        }
        return new FileInfo();
    }
}
